<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加入库商品</title>
    <!-- <link rel="stylesheet" href="../css/plant.css"> -->
    <script src="../lib/bootstrap-3.3.5-dist/js/jquery-1.11.3.js"></script>
    <style>
      * {
        box-sizing: border-box;
      }
      .mydiv {
        font-size: 20px;
        font-weight: bold;
        height: 80px;
        color: #333333;
        margin: 40px 20% 0 20%;
      }
      #information {
        font-size: 18px;
        width: 60%;
        margin: 0 auto;
        text-align: center;
        background-color: #F0F2F5;
        padding: 36px;
        border-radius: 12px;
      }
      #information select,
      #information input {
        width: 94%;
        margin-left: 6%;
        border: none;
        outline: none;
        height: 50px;
        margin: 10px 0;
      }
      #confirm,
      #back {
        width: 92%;
        height: 36px;
        width: 60px;
        font-size: 14px;
        border: none;
        background-color: #4DC3B6;
        color: white;
        border-radius: 4px;
        width: 15%;
      }
      .but {
        text-align: center;
      }
    </style>
</head>

<body>
    <div class="mydiv">
        <span>商品入库新增</span>
    </div>
    <table id="information" cellspacing='0'>
        <tr>
            <td>入库编号</td>
            <td><input type="text" id="rkId"></td>
        </tr>
        <tr>
            <td>运输编号</td>
            <td><input type="text" id="ysId"></td>
        </tr>
        <tr>
            <td>仓库编号</td>
            <td>
              <select id="houseId">
                <option value="100001">100001</option>
                <option value="100002">100002</option>
                <option value="100003">100003</option>
                <option value="100004">100004</option>
                <option value="100005">100005</option>
                <option value="100006">100006</option>
                <option value="100007">100007</option>
                <option value="100008">100008</option>
                <option value="100009">100009</option>
                <option value="100010">100010</option>
              </select>
            </td>
        </tr>
        <tr>
            <td>入库数量</td>
            <td><input type="text" id="rkNumber"></td>
        </tr>
        <tr>
            <td>入库时间</td>
            <td><input type="date" id="rkDate"></td>
        </tr>
    </table>
    <div class="mydiv but">
        <button id="back">返回</button>
        <button id="confirm">确认</button>
    </div>

</body>
<script>
    $('#back').click(() => {
        window.location = './stockIn.html'
    })

    // 新增入库商品
    $('#confirm').click(()=>{
      $.ajax({
        url:'/stockIn/add',
        method:'post',
        data:{
          in_stock_id:$('#rkId').val(),
          trans_id:$('#ysId').val(),
          house_id:$('#houseId').val(),
          in_stock_quantity:$('#rkNumber').val(),
          in_stock_date:$('#rkDate').val()
        },
        success:(res)=>{
          console.log(res);
          alert('添加成功');
          window.location = './stockIn.html'
        }
      })
    })
</script>

</html>